import { getHospitalLevelAndRegionAPI } from '@/api/home';
import { HospitalDicData, HospitalDictArr } from '@/api/home/type';
import { onMounted, ref } from 'vue';

export function useDict() {
    onMounted(() => {
        getDictData()
    })
    let levelData = ref < HospitalDictArr > ([])
    let regionData = ref < HospitalDictArr > ([])
    const getDictData = async () => {
        let res: HospitalDicData = await getHospitalLevelAndRegionAPI('hosType')
        levelData.value = res.data
        let res1: HospitalDicData = await getHospitalLevelAndRegionAPI('Beijin')
        regionData.value = res1.data
    }

    return{
        levelData,
        regionData
    }
}